package com.buaa.divinationmaster.model;

/**
 * 塔罗牌数据模型
 * 对应需求文档中的tarot_cards数据表
 */
public class TarotCard {
    private int id;                    // 牌序（0-77）
    private String nameZh;             // 中文名
    private String nameEn;             // 英文名
    private CardType type;             // 大/小阿卡纳
    private Suit suit;                 // 花色（仅小阿卡纳）
    private Integer number;            // 牌号
    private String imagePath;          // 图片路径
    private String uprightKeywords;    // 正位关键词
    private String uprightMeaning;     // 正位含义
    private String reversedKeywords;   // 逆位关键词
    private String reversedMeaning;    // 逆位含义
    private Element element;           // 元素属性
    
    public enum CardType {
        MAJOR_ARCANA("major"),  // 大阿卡纳
        MINOR_ARCANA("minor");  // 小阿卡纳
        
        private String value;
        CardType(String value) { this.value = value; }
        public String getValue() { return value; }
    }
    
    public enum Suit {
        NONE(""),          // 大阿卡纳无花色
        WANDS("wands"),    // 权杖
        CUPS("cups"),      // 圣杯
        SWORDS("swords"),  // 宝剑
        PENTACLES("pentacles"); // 星币
        
        private String value;
        Suit(String value) { this.value = value; }
        public String getValue() { return value; }
    }
    
    public enum Element {
        FIRE("火"),    // 火
        WATER("水"),   // 水
        AIR("风"),     // 风
        EARTH("土");   // 土
        
        private String name;
        Element(String name) { this.name = name; }
        public String getName() { return name; }
    }
    
    // 构造函数
    public TarotCard() {}
    
    public TarotCard(int id, String nameZh, String nameEn, CardType type) {
        this.id = id;
        this.nameZh = nameZh;
        this.nameEn = nameEn;
        this.type = type;
        this.suit = (type == CardType.MAJOR_ARCANA) ? Suit.NONE : Suit.WANDS;
    }
    
    // Getters and Setters
    public int getId() { return id; }
    public void setId(int id) { this.id = id; }
    
    public String getNameZh() { return nameZh; }
    public void setNameZh(String nameZh) { this.nameZh = nameZh; }
    
    public String getNameEn() { return nameEn; }
    public void setNameEn(String nameEn) { this.nameEn = nameEn; }
    
    public CardType getType() { return type; }
    public void setType(CardType type) { this.type = type; }
    
    public Suit getSuit() { return suit; }
    public void setSuit(Suit suit) { this.suit = suit; }
    
    public Integer getNumber() { return number; }
    public void setNumber(Integer number) { this.number = number; }
    
    public String getImagePath() { return imagePath; }
    public void setImagePath(String imagePath) { this.imagePath = imagePath; }
    
    public String getUprightKeywords() { return uprightKeywords; }
    public void setUprightKeywords(String uprightKeywords) { this.uprightKeywords = uprightKeywords; }
    
    public String getUprightMeaning() { return uprightMeaning; }
    public void setUprightMeaning(String uprightMeaning) { this.uprightMeaning = uprightMeaning; }
    
    public String getReversedKeywords() { return reversedKeywords; }
    public void setReversedKeywords(String reversedKeywords) { this.reversedKeywords = reversedKeywords; }
    
    public String getReversedMeaning() { return reversedMeaning; }
    public void setReversedMeaning(String reversedMeaning) { this.reversedMeaning = reversedMeaning; }
    
    public Element getElement() { return element; }
    public void setElement(Element element) { this.element = element; }
    
    /**
     * 获取牌的显示名称（中英文）
     */
    public String getDisplayName() {
        return nameZh + " (" + nameEn + ")";
    }
    
    /**
     * 根据方向获取含义
     */
    public String getMeaning(boolean isReversed) {
        return isReversed ? reversedMeaning : uprightMeaning;
    }
    
    /**
     * 根据方向获取关键词
     */
    public String getKeywords(boolean isReversed) {
        return isReversed ? reversedKeywords : uprightKeywords;
    }
    
    /**
     * 获取方向描述
     */
    public String getOrientationText(boolean isReversed) {
        return isReversed ? "逆位" : "正位";
    }
}
